<template>
  <el-container class="layout-page">
    <el-aside width="226px">
      <div class="logo"><img src="@/assets/title.ef005a7a.png" alt="" /></div>
      <el-row class="tac">
        <el-col :span="24">
          <el-menu
            default-active="1"
            class="el-menu-vertical-demo"
            @open="handleOpen"
            @close="handleClose"
            router
          >
            <!-- 工作台 -->
            <el-menu-item index="/dashboard">
              <i class="el-icon-menu"></i>
              <span slot="title">工作台</span>
            </el-menu-item>
            <!-- 基础信息管理 -->
            <el-submenu>
              <template slot="title">
                <i class="el-icon-tickets"></i>
                <span>基础信息管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="/warehouse"> 仓库管理</el-menu-item>
                <el-menu-item index="2-2">库区管理</el-menu-item>
                <el-menu-item index="2-3">库位管理</el-menu-item>
                <el-menu-item index="2-4">库位视图</el-menu-item>
                <el-menu-item index="2-5">货品管理</el-menu-item>
                <el-menu-item index="2-6">货品类型管理</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!-- 商务管理 -->
            <el-submenu index="3">
              <template slot="title">
                <i class="iconfont icon-shangwu"></i>
                <span>商务管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="3-1">货主管理</el-menu-item>
                <el-menu-item index="3-2">承运商管理</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!-- 库内管理 -->
            <el-submenu index="4">
              <template slot="title">
                <i class="el-icon-house"></i>
                <span>库内管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="4-1">盘点单</el-menu-item>
                <el-menu-item index="4-2">盘点任务</el-menu-item>
                <el-menu-item index="4-3">库存损益</el-menu-item>
                <el-menu-item index="4-4">实时库存</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!-- 入库管理 -->
            <el-submenu index="5">
              <template slot="title">
                <i class="iconfont icon-rukuguanli"></i>
                <span>入库管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="5-1">入库单</el-menu-item>
                <el-menu-item index="5-2">收货任务</el-menu-item>
                <el-menu-item index="5-3">上架任务</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
            <!-- 出库管理 -->
            <el-submenu index="6">
              <template slot="title">
                <i class="iconfont icon-chukuguanli"></i>
                <span>出库管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item index="6-1">出货单</el-menu-item>
                <el-menu-item index="6-2">拣货任务</el-menu-item>
                <el-menu-item index="6-3">交接任务</el-menu-item>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-col>
      </el-row>
      <div class="aside-footer">
        <el-avatar
          :size="32"
          src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
        >
        </el-avatar>
        <div class="title">admin</div>
        <div class="divsplit">|</div>
        <div
          class="el-icon-switch-button"
          @click="$router.push('/login')"
        ></div>
      </div>
    </el-aside>

    <el-container>
      <el-header>
        <NavBar />
      </el-header>
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import NavBar from './components/NavBar.vue'
export default {
  components: {
    NavBar
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    }
  }
}
</script>

<style lang="scss" scoped>
::v-deep.layout-page {
  width: 100vw;
  height: 100vh;
  .el-aside {
    position: relative;
    transition: width 0.28s;
    width: 226px !important;
    height: 100%;
    position: fixed;
    font-size: 0;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1001;
    overflow: hidden;
    background: #fff;
    box-shadow: 2px 0 6px 0 rgb(144 142 142 / 13%);
    .logo {
      height: 100px;
      width: 150px;
      img {
        width: 150px;
        height: 64px;
        margin-left: 40px;
        margin-top: 20px;
      }
    }
    .aside-footer {
      position: absolute;
      // position: relative;
      display: flex;
      flex-direction: row;
      align-items: center;
      bottom: 0px;
      width: 100%;
      height: 62px;
      border-top: 1px solid #f5efee;
      align-items: center;
      .el-avatar {
        // position: absolute;
        width: 32px;
        height: 32px;
        margin-left: 41px;
        margin-right: 14px;
        margin-top: 20px;
      }
      .title {
        height: 20px;
        font-size: 14px;
        margin-top: 20px;
        font-family: PingFangSC, PingFangSC-Regular;
        font-weight: 400;
        text-align: left;
        color: #332929;
        line-height: 20px;
      }
      .divsplit {
        height: 17px;
        margin-top: 20px;
        border-left: 1px solid #d9d0cf;
        border-right: 0;
        margin-left: 17px;
        margin-right: 17px;
      }
      .el-icon-switch-button {
        margin-top: 20px;
        font-size: 28px;
        cursor: pointer;
        color: #b5abab;
      }
    }
  }
  .el-menu-item.is-active {
    background: #fff6e2 !important;
    border-radius: 0 100px 100px 0;
  }
  .el-submenu [class^="iconfont"] {
    vertical-align: middle;
    margin-right: 5px;
    width: 24px;
    text-align: center;
    font-size: 18px;
  }
  .el-submenu [class^="el-icon-"] {
    vertical-align: middle;
    margin-right: 0px;
    width: 24px;
    text-align: center;
    font-size: 18px;
  }
  .el-header {
    width: 100vw;
    background-color: #f5f1f1;
  }
  .el-main {
    padding: 20px 30px 30px 250px;
    background-color: #fdfafa;
  }
}
</style>
